﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>新闻发布</title>
<link href="${backPath}/images/skin.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #EEF2FB;
	font-size: 12px;
}
.STYLE1 {
	font-size: 12px;
	cursor:pointer;
}
.STYLE4 {
	font-size: 12px;
	color: #1F4A65;
	font-weight: bold;
}
a:link {
	font-size: 12px;
	color: #06482a;
	text-decoration: none;

}
a:visited {
	font-size: 12px;
	color: #06482a;
	text-decoration: none;
}
a:hover {
	font-size: 12px;
	color: #FF0000;
	text-decoration: underline;
}
a:active {
	font-size: 12px;
	color: #FF0000;
	text-decoration: none;
}
.STYLE7 {font-size: 12}
-->
</style>
<script type="text/javascript" language="javascript">
var  highlightcolor='#E6EDF2';
//此处clickcolor只能用win系统颜色代码才能成功,如果用#xxxxxx的代码就不行,还没搞清楚为什么:(
var  clickcolor='#51b2f6';
function  changeto(){
source=event.srcElement;
if  (source.tagName=="TR"||source.tagName=="TABLE")
return;
while(source.tagName!="TD")
source=source.parentElement;
source=source.parentElement;
cs  =  source.children;
//alert(cs.length);
if  (cs[1].style.backgroundColor!=highlightcolor&&source.id!="nc"&&cs[1].style.backgroundColor!=clickcolor)
for(i=0;i<cs.length;i++){
	cs[i].style.backgroundColor=highlightcolor;
}
}

function  changeback(){
if  (event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="nc")
return
if  (event.toElement!=source&&cs[1].style.backgroundColor!=clickcolor)
//source.style.backgroundColor=originalcolor
for(i=0;i<cs.length;i++){
	cs[i].style.backgroundColor="";
}
}

/*function  clickto(){
source=event.srcElement;
if  (source.tagName=="TR"||source.tagName=="TABLE")
return;
while(source.tagName!="TD")
source=source.parentElement;
source=source.parentElement;
cs  =  source.children;
//alert(cs.length);
if  (cs[1].style.backgroundColor!=clickcolor&&source.id!="nc")
for(i=0;i<cs.length;i++){
	cs[i].style.backgroundColor=clickcolor;
}
else
for(i=0;i<cs.length;i++){
	cs[i].style.backgroundColor="";
}
}*/
//全选按钮
function checkAll() {
	  for (var i = 0; i < document.getElementsByName("checkbox").length; i++) {
	   document.getElementsByName("checkbox")[i].checked = document.getElementById("selectAll").checked;
	  }
 }
//批量删除记录
function deleteCardBuys(){
	if(document.getElementsByName("checkbox").length != 0){	
		if(document.getElementById("selectAll").checked){
			if(window.confirm('确定要删除这些记录吗')){
			    var form=document.getElementById("cardbuyform");
			    form.action = "${backPath}/cardbuy/deleteBatch.action";
				form.submit();
			}
		}else{
	      alert("请点击［全选］");
		}
	}else{
		alert("没有任何记录可供选择!");
	}
}
//删除单条记录
function deleteCardBuy(regId){
	if(confirm('确定要删除本条订购信息吗？')){
		document.getElementById('cardbuy.regid').value = regId;
		var form = document.getElementById("cardbuyform");
		form.action = "${backPath}/cardbuy/delete.action";
		form.submit();
	}
}

//查询不同状态下的订购信息
function changeState(){
	var form = document.getElementById("cardbuyform");
	form.action = "${backPath}/cardbuy/list.action";
	form.submit();
}
//选择不同的页数
function selectPage(){
	document.getElementById("page.pageNo").value = document.getElementById("selectPageNo").value;
	var form = document.getElementById("cardbuyform");
	form.action = "${backPath}/cardbuy/list.action";
	form.submit();	
}
//改变不同的页数
function changePage(pageNo){
	document.getElementById("page.pageNo").value = pageNo;
	var form = document.getElementById("cardbuyform");
	form.action = "${backPath}/cardbuy/list.action";
	form.submit();	
}
//更新指定的记录
function editCardBuy(id){
	//document.getElementById("card.regid").value = id;
	//var form = document.getElementById("cardbuyform");
	//form.action = "${backPath}/cardbuy/editCardBuy.action";	
	//form.submit();
	window.open("${backPath}/cardbuy/editCardBuy.action?cardbuy.regid=" + id);	
}
</script>
</head>
<body>
<form name="cardbuyForm" id="cardbuyform" action="">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="17" valign="top" background="${backPath}/images/mail_leftbg.gif"><img src="${backPath}/images/left-top-right.gif" width="17" height="29" /></td>

    <td valign="top" background="${backPath}/images/content-bg.gif"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
      <tr>
        <td height="31"><div class="titlebt">集体购卡</div></td>
      </tr>
    </table></td>
    <td width="16" valign="top" background="${backPath}/images/mail_rightbg.gif"><img src="${backPath}/images/nav-right-bg.gif" width="16" height="29" /></td>
  </tr>
  <tr>
    <td valign="middle" background="${backPath}/images/mail_leftbg.gif">&nbsp;</td>
    <td valign="top" bgcolor="#F7F8F9"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="15" height="30"><img src="${backPath}/images/list/tab_031.gif" width="15" height="30" /></td>
        <td width="471" background="${backPath}/images/list/tab_051.gif"><img src="${backPath}/images/list/311.gif" width="16" height="16" /> <span class="STYLE4">订购信息</span></td>
        <td width="494" background="${backPath}/images/list/tab_051.gif">
		<table border="0" align="right" cellpadding="0" cellspacing="0" width="600">
            <tr>
              <td>
                 <input type="radio" name="cardbuy.state" value='0'
                 	<c:if test="${cardbuy.state =='0'}">checked</c:if>
                    	onclick="changeState()" />未处理                    	
					&nbsp;&nbsp;
                    <input type="radio"  name="cardbuy.state" value='1' 
                    		<c:if test="${cardbuy.state == '1'}">checked</c:if>
                    	onclick="changeState()"/>已处理
              </td>
              <td width="146"><table width="88%" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td class="STYLE1"><div align="center">
                      <input type="checkbox" name="checkbox62" value="checkbox" id="selectAll" onClick="checkAll()"/>
全选</div></td>
                    <td class="STYLE1"><div align="center"><img src="${backPath}/images/list/083.gif" width="14" height="14" onClick="deleteCardBuys()"/>删除</div></td>
                  </tr>
              </table></td>
            </tr>
        </table></td>
        <td width="15"><img src="${backPath}/images/list/tab_071.gif" width="14" height="30" /></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>

        <td width="9" background="${backPath}/images/list/tab_121.gif">&nbsp;</td>
        <td bgcolor="#EEF2FB"><table width="99%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#9EAEB9" onMouseOver="changeto()"  onmouseout="changeback()">
          <tr>
            <td width="6%" height="26" background="${backPath}/images/list/tab_141.gif" class="STYLE1"><div align="center" class="STYLE2 STYLE1">选择</div></td>
            <td width="40%" height="26" background="${backPath}/images/list/tab_141.gif" class="STYLE1"><div align="center" class="STYLE2 STYLE1">购卡单位</div></td>
            <td width="14%" height="26" background="${backPath}/images/list/tab_141.gif" class="STYLE1"><div align="center" class="STYLE2">联系人</div></td>
            <td width="10%" height="26" background="${backPath}/images/list/tab_141.gif" class="STYLE1"><div align="center" class="STYLE2">联系电话</div></td>
            <td width="10%" height="26" background="${backPath}/images/list/tab_141.gif" class="STYLE1"><div align="center" class="STYLE2">注册日期</div></td>                       
            <td width="10%" height="26" background="${backPath}/images/list/tab_141.gif" class="STYLE1"><div align="center" class="STYLE2">编辑</div></td>
            <td width="10%" height="26" background="${backPath}/images/list/tab_141.gif" class="STYLE1"><div align="center" class="STYLE2">删除</div></td>
          </tr>        
          <s:if test="%{page.data.size == 0}">
          	<tr>
          		<td colspan="7" height="30" bgcolor="#FFFFFF">
          			<div align="center" class="STYLE2 STYLE1">没有查到符合条件的订购信息！</div>
          		</td>
          	</tr>
          </s:if> 
          <s:else> 
          <c:forEach items="${page.data}" var="cardbuy">
          <tr>
            <td height="18" bgcolor="#FFFFFF"><div align="center" class="STYLE1">
              <input name="checkbox" type="checkbox" class="STYLE2" value="${cardbuy.regid}" />
            </div></td>
            <td height="18" bgcolor="#FFFFFF"><div align="center" class="STYLE2 STYLE1">${cardbuy.company}</div></td>
            <td height="18" bgcolor="#FFFFFF"><div align="center" >${cardbuy.linkman}</td>
            <td height="18" bgcolor="#FFFFFF"><div align="center" >${cardbuy.phone}</td>
            <td height="18" bgcolor="#FFFFFF"><div align="center" >${cardbuy.regDate}</td>
            <td height="18" bgcolor="#FFFFFF"><div align="center"><img src="${backPath}/images/list/037.gif" width="9" height="9" /><span class="STYLE1"> [</span><a href="javascript:editCardBuy(${cardbuy.regid})">编辑</a><span class="STYLE1">]</span></div></td>
            <td height="18" bgcolor="#FFFFFF"><div align="center"><span class="STYLE2"><img src="${backPath}/images/list/010.gif" width="9" height="9" /> </span><span class="STYLE1">[</span><a href="javascript:deleteCardBuy(${cardbuy.regid})">删除</a><span class="STYLE1">]</span></div></td>
          </tr>
          </c:forEach>
          </s:else>
        </table></td>
        <td width="9" background="${backPath}/images/list/tab_161.gif">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  
  <tr>
    <td height="29">
    <s:if test="%{page.data.size > 0}">
    	<table width="100%" border="0" cellspacing="0" cellpadding="0">     
      <tr>
        <td width="15" height="29"><img src="${backPath}/images/list/tab_201.gif" width="15" height="29" /></td>
        <td background="${backPath}/images/list/tab_211.gif">        
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="25%" height="29" nowrap="nowrap"><span class="STYLE1">共${page.recordCount}条纪录，当前第${page.pageNo}页/共${page.totalPages}页，每页${page.pageSize}条纪录</span></td>
            <td width="75%" valign="top" class="STYLE1"><div align="right">			
              <table width="352" height="20" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <c:if test="${page.pageNo > 1}">
                  	<td width="62" height="22" valign="middle"><div align="right"><a href="javascript:changePage(1)"><img src="${backPath}/images/list/first1.gif" width="39" height="17"/></a></div></td>
                  	<td width="50" height="22" valign="middle"><div align="right"><a href="javascript:changePage(${page.pageNo-1})"><img src="${backPath}/images/list/back1.gif" width="45" height="17" /></a></div></td>
                  </c:if>
                  <c:if test="${page.pageNo < page.totalPages}">
                  	<td width="54" height="22" valign="middle"><div align="right"><a href="javascript:changePage(${page.pageNo+1})"><img src="${backPath}/images/list/next1.gif" width="45" height="17" /></a></div></td>
                  	<td width="49" height="22" valign="middle"><div align="right"><a href="javascript:changePage(${page.totalPages})"><img src="${backPath}/images/list/last1.gif" width="39" height="17" /></a></div></td>                  
                  </c:if>
                  <td width="59" height="22" valign="middle"><div align="right">选择第</div></td>                  
                  <td width="25" height="22" valign="middle"><span class="STYLE7">
                  	<select id="selectPageNo" onchange="selectPage()">
                  		<c:forEach begin="1" end="${page.totalPages}" varStatus="status">
                  			<option value="${status.index}"
                  			    <c:if test="${page.pageNo == (status.index)}">selected</c:if>
                  				>${status.index}</option>
                  		</c:forEach>	
                  	</select>                   
                  </td>
                  <td width="23" height="22" valign="middle">页</td>
                  <td width="30" height="22" valign="middle"></td>                  
                </tr>
              </table>
               
            </div></td>
          </tr>
        </table>
        </td>
        <td width="14"><img src="${backPath}/images/list/tab_221.gif" width="14" height="29" /></td>
      </tr>
    </table>
    </s:if>
     <s:else>
    	<table width="100%" border="0" cellspacing="0" cellpadding="0">     
      <tr>
        <td width="15" height="29"><img src="${backPath}/images/list/tab_201.gif" width="15" height="29" /></td>
        <td background="${backPath}/images/list/tab_211.gif">        
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="25%" height="29" nowrap="nowrap"></td>
            <td width="75%" valign="top" class="STYLE1"><div align="right">			
              <table width="352" height="20" border="0" cellpadding="0" cellspacing="0">
                <tr>
                                  
                </tr>
              </table>
               
            </div></td>
          </tr>
        </table>
        </td>
        <td width="14"><img src="${backPath}/images/list/tab_221.gif" width="14" height="29" /></td>
      </tr>
    </table>
    </s:else>
    </td>
  </tr>
 
			<tr>
          		<td colspan="7" height="30" bgcolor="#FFFFFF">
          			<div align="center" class="STYLE2 STYLE1"><font color="blue"><s:actionmessage/></font></div>
          		</td>
          	</tr>
</table>

</td>
    <td background="${backPath}/images/mail_rightbg.gif">&nbsp;</td>
  </tr>
  <tr>
    <td valign="bottom" background="${backPath}/images/mail_leftbg.gif"><img src="${backPath}/images/buttom_left2.gif" width="17" height="17" /></td>
    <td background="${backPath}/images/buttom_bgs.gif"><img src="${backPath}/images/buttom_bgs.gif" width="17" height="17"></td>
    <td valign="bottom" background="${backPath}/images/mail_rightbg.gif"><img src="${backPath}/images/buttom_right2.gif" width="16" height="17" /></td>
  </tr>
</table>
<input type="hidden" value="${page.pageNo}" name="page.pageNo"/>
<input type="hidden" name="cardbuy.regid" id="card.regid"/>
</form>
</body>
</html>